package com.example.mqdemo.util;

import com.example.mqdemo.bean.MsgData;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

@Slf4j
@Service
public class MsgUtil {

    /**
     * 装数据的集合
     */
    private final static Map<String, MsgData> dataMap = new ConcurrentHashMap<>(64);

    public MsgData getMsgData(String key) {
        return dataMap.get(key);
    }

    public Map<String, MsgData> getData() {
        return dataMap;
    }

    public void setData(String key, MsgData value) {
        dataMap.put(key, value);
    }
}
